<?php


session_start();

//$connect = mysql_connect('localhost','','lxygwqfqsgctys');
$connect = mysql_connect('localhost','test','123456');
if (! $connect)
{
	die('Could not connect: ' . mysql_error());
}

mysql_select_db('login', $connect);

$username=$_POST['username'];
$password=$_POST['password'];


$sql = "SELECT * FROM user WHERE username = '$username' AND password = '$password' ";
$query = mysql_query($sql, $connect);

if (mysql_num_rows($query) <= 0) {
	echo 'login fail!!';
?>
	<p><a href="./login.html">返回登陆</a></p>
<?php
}else{

	$_SESSION['login'] = $username;

	header("Location: ./index.php?type=5&protocal=1001");
}
?>